
[dbo].[sp_asi_sp_columns_ts]
CREATE PROCEDURE sp_asi_sp_columns_ts (@table_name varchar(96))
as
select
'' TABLE_QUALIFIER,
'' TABLE_OWNER,
'' TABLE_NAME,
convert (varchar(96), c.name) COLUMN_NAME,
0 DATA_TYPE,
convert (varchar(96),
case when ColumnProperty (c.id, c.name, 'IsIdentity') = 1
then 'int identity'
else t.name
end)
'TYPE_NAME',
convert(int,
case when t.name = 'float' then 15
when t.name = 'real' then 7
else OdbcPrec(c.xtype,c.length,c.xprec)
end) 'PRECISION',
convert(int, case
when t.name IN ('money', 'numeric','decimal')
then OdbcPrec(c.xtype,c.length,c.xprec)+2
when t.name IN ('datetime')
then 16
when t.name IN ('text', 'image')
then OdbcPrec(c.xtype,c.length,c.xprec)
else c.length
end) 'LENGTH',
SCALE = convert(smallint, OdbcScale(c.xtype,c.xscale)),
0 RADIX,
isnullable NULLABLE,
NULL REMARKS,
colorder ORDINAL_POSITION
from syscolumns c
inner join systypes t on c.usertype = t.usertype
where id = (select id from sysobjects where name = @table_name)
order by ORDINAL_POSITION
GO
GRANT EXECUTE ON [dbo].[sp_asi_sp_columns_ts] TO [IMIS]
GO